﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input.Touch;


namespace LoD.WPClientLibrary.Controls {
    public class Label : GuiControl {
        public Label(ContentManager content, SpriteBatch spriteBatch, SpriteFont font)
            : base(content, spriteBatch, font) {
            this.Text = string.Empty;
            Color = Color.White;
            this.TextColor = Color.White;
            this.ShadowColor = Color.Black;
            this.UseShadow = true;
        }

        public string Text { get; set; }
        public Color ShadowColor { get; set; }
        public Color TextColor { get; set; }
        public bool UseShadow { get; set; }

        // ReSharper disable RedundantOverridenMember
        public override void Update(TouchLocation touch) { base.Update(touch); }
        // ReSharper restore RedundantOverridenMember

        public override void Draw() {
            if (this.UseShadow) {
                SpriteBatch.DrawString(Font, this.Text,
                                       new Vector2(Position.X - 2, Position.Y - 2), this.ShadowColor);
            }
            SpriteBatch.DrawString(Font, this.Text, Position, this.TextColor);
        }

        public Vector2 TextSize() { return Font.MeasureString(this.Text); }
    }
}